package com.fivefu.core.camera.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fivefu.core.camera.entity.DbMonitorStatus;
import com.fivefu.core.camera.mapper.DbMonitorStatusMapper;
import com.fivefu.core.camera.services.DbMonitorStatusService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 基础状态 服务实现类
 * </p>
 *
 * @author 
 * @since 2022-10-10 10:56:49
 */
@Service
public class DbMonitorStatusServiceImpl extends ServiceImpl<DbMonitorStatusMapper, DbMonitorStatus> implements DbMonitorStatusService {

    /**
     * 通过类型查询状态
     * @param type(examine : 审核,event : 案卷状态,push : 案卷推送状态)
     * @return
     */
    @Override
    public List<DbMonitorStatus> queryMonitorStatusByType(String type){
        QueryWrapper<DbMonitorStatus> wrapper = new QueryWrapper<>();
        wrapper.eq("is_delete",0);
        wrapper.eq("status_type", type);
        wrapper.orderByAsc("sort");
        wrapper.select("id,status_name,status_type");
        List<DbMonitorStatus> list = baseMapper.selectList(wrapper);
        return list;
    }

    /**
     * 通过状态编号查询状态详情
     * @param id
     * @return
     */
    @Override
    public String queryStatusNameById(Long id){
        DbMonitorStatus status = baseMapper.selectById(id);
        return status.getStatusName();
    }

}
